<template>
  <div>
    <el-table class="mt10" v-loading="loading" :data="dealList" border stripe>
      <el-table-column label="区域" prop="region" align="center" min-width="80"/>
      <el-table-column label="登记物" prop="proNames" show-overflow-tooltip align="center" min-width="260"/>
      <el-table-column label="物品总数" prop="disposalProNumberSum" align="center" min-width="80"/>
      <el-table-column label="物品条数" prop="disposalProNumberCount" align="center" min-width="80"/>
      <el-table-column label="物品总价值" prop="disposalProAmountSum" align="center" min-width="100"/>
      <el-table-column label="处置状态" align="center" prop="dealType" min-width="80">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.deal_type" :value="scope.row.disposalStat"/>
        </template>
      </el-table-column>
      <el-table-column label="登记时间" prop="createTime" align="center" min-width="150"/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="80">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-view" @click="handleInfo(scope.row)">查看</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row.id)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { deleteDisposalRegistered, listDisposalRegistered } from '@/api/sacw/dispose'
import { delBoxDept } from '@/api/oms/boxDept'

export default {
  dicts: ['deal_type'],
  props: {
    queryParams: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      total: 0,
      loading: false,
      dealList: []
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.loading = true
      listDisposalRegistered(this.queryParams).then(response => {
        this.dealList = response.rows
        this.total = response.total
      }).finally(() => {
        this.loading = false
      })
    },
    handleInfo(row) {
      this.$emit('handleInfo', row)
    },
    handleDelete(id) {
      this.$modal.confirm('是否确认删除？').then(() => {
        deleteDisposalRegistered(id).then(() => {
          this.$modal.msgSuccess('删除成功')
          this.getList()
        })
      })
    }
  }
}
</script>

<style scoped>

</style>
